package com.eurake.seckill.controller;

import com.eurake.seckill.service.IOrderService;
import com.eurake.seckill.vo.OrderDetailVo;
import com.eurake.seckill.vo.RespBean;
import com.eurake.seckill.vo.RespBeanEnum;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;
import com.eurake.seckill.pojo.User;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chen
 * @since 2024-11-24
 */
@Controller
@RequestMapping("/order")
public class OrderController {
    @Resource
    private IOrderService orderService;

    @RequestMapping("/detail")
    @ResponseBody
    public RespBean detail(User user, Long orderId){
        if (null == user){
            return RespBean.error(RespBeanEnum.SESSION_ERROR);
        }
        OrderDetailVo detail = orderService.detail(orderId);
        return RespBean.success(detail);
    }
}
